<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  
  
  <title>基于Phabricator的Git服务器搭建 | 惘客的个人博客</title>
  <meta name="description" content="系统环境123# CentOS8 root用户uname -aLinux localhost.localdomain 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU&#x2F;Linux  安装依赖项Git1yum install git  Nginx12345678# 安装EPEL repoy">
<meta property="og:type" content="article">
<meta property="og:title" content="基于Phabricator的Git服务器搭建">
<meta property="og:url" content="https://gycherish.gitee.io/blog/posts/57649896.html">
<meta property="og:site_name" content="惘客的个人博客">
<meta property="og:description" content="系统环境123# CentOS8 root用户uname -aLinux localhost.localdomain 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU&#x2F;Linux  安装依赖项Git1yum install git  Nginx12345678# 安装EPEL repoy">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gycherish.gitee.io/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/502-bad-gateway.png">
<meta property="og:image" content="https://gycherish.gitee.io/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/selinux.png">
<meta property="og:image" content="https://gycherish.gitee.io/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/register.png">
<meta property="article:published_time" content="2020-05-27T16:00:00.000Z">
<meta property="article:modified_time" content="2022-11-06T10:30:14.081Z">
<meta property="article:author" content="惘客">
<meta property="article:tag" content="git">
<meta property="article:tag" content="phabricator">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gycherish.gitee.io/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/502-bad-gateway.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://gycherish.gitee.io/blog/posts/57649896.html">
  
    <link rel="alternate" href="/atom.xml" title="惘客的个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/blog/css/style.css">

  
  
  
  
<meta name="generator" content="Hexo 4.2.1"></head>


<body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://gitee.com/gycherish" target="_blank">
          <img class="img-circle img-rotate" src="/blog/images/head.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">惘客</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Linux C++ Server Developer</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> Shanghai, China</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav ">
        
        
        <li class="menu-item menu-item-home">
          <a href="/blog/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories">
            
            <i class="icon icon-folder"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/blog/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">项目</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎交流与分享经验!</p>
            </div>
        </div>
    </div>
</div>

    
      

    
      
  <div class="widget">
    <h3 class="widget-title">标签</h3>
    <div class="widget-body">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/bios/" rel="tag">bios</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/c/" rel="tag">c++</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cmake/" rel="tag">cmake</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cpu/" rel="tag">cpu</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/develop/" rel="tag">develop</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/docker/" rel="tag">docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/dpdk/" rel="tag">dpdk</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/fs/" rel="tag">fs</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/git/" rel="tag">git</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/hexo/" rel="tag">hexo</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/linux/" rel="tag">linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/lvm/" rel="tag">lvm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/mbr/" rel="tag">mbr</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/os/" rel="tag">os</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/phabricator/" rel="tag">phabricator</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/tmux/" rel="tag">tmux</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/yum/" rel="tag">yum</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/blog/tags/bios/" style="font-size: 13px;">bios</a> <a href="/blog/tags/c/" style="font-size: 13px;">c++</a> <a href="/blog/tags/cmake/" style="font-size: 13px;">cmake</a> <a href="/blog/tags/cpu/" style="font-size: 13px;">cpu</a> <a href="/blog/tags/develop/" style="font-size: 14px;">develop</a> <a href="/blog/tags/docker/" style="font-size: 13px;">docker</a> <a href="/blog/tags/dpdk/" style="font-size: 13px;">dpdk</a> <a href="/blog/tags/fs/" style="font-size: 13.25px;">fs</a> <a href="/blog/tags/git/" style="font-size: 13.75px;">git</a> <a href="/blog/tags/hexo/" style="font-size: 13.5px;">hexo</a> <a href="/blog/tags/linux/" style="font-size: 13.5px;">linux</a> <a href="/blog/tags/lvm/" style="font-size: 13px;">lvm</a> <a href="/blog/tags/mbr/" style="font-size: 13px;">mbr</a> <a href="/blog/tags/os/" style="font-size: 13.25px;">os</a> <a href="/blog/tags/phabricator/" style="font-size: 13px;">phabricator</a> <a href="/blog/tags/tmux/" style="font-size: 13px;">tmux</a> <a href="/blog/tags/yum/" style="font-size: 13px;">yum</a>
    </div>
  </div>

    
      
  <div class="widget">
    <h3 class="widget-title">归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/05/">五月 2022</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/04/">四月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/01/">一月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/08/">八月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/05/">五月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/03/">三月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/06/">六月 2020</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/05/">五月 2020</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2019/11/">十一月 2019</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled no-thumbnail">
        
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/dc0447d5.html" class="title">bios</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-17T09:35:00.000Z" itemprop="datePublished">2022-05-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/57db9b5a.html" class="title">Intel处理器架构简介</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-16T07:05:00.000Z" itemprop="datePublished">2022-05-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7d606a33.html" class="title">高性能编程指南</a>
              </p>
              <p class="item-date">
                <time datetime="2022-04-07T09:30:00.000Z" itemprop="datePublished">2022-04-07</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7deb74e6.html" class="title">编译编译器</a>
              </p>
              <p class="item-date">
                <time datetime="2022-01-17T13:55:50.000Z" itemprop="datePublished">2022-01-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/aa24c566.html" class="title">编写changelog</a>
              </p>
              <p class="item-date">
                <time datetime="2021-08-13T07:59:30.000Z" itemprop="datePublished">2021-08-13</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<main class="main" role="main">
  <div class="content">
  <article id="post-Git/基于Phabricator的Git服务器搭建" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      基于Phabricator的Git服务器搭建
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/blog/posts/57649896.html" class="article-date">
	  <time datetime="2020-05-27T16:00:00.000Z" itemprop="datePublished">2020-05-28</time>
	</a>
</span>
        
        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link" href="/blog/tags/git/" rel="tag">git</a>, <a class="article-tag-link" href="/blog/tags/phabricator/" rel="tag">phabricator</a>
  </span>


        
	<span class="article-read hidden-xs">
	    <i class="icon icon-eye-fill" aria-hidden="true"></i>
	    <span id="busuanzi_container_page_pv">
			<span id="busuanzi_value_page_pv">0</span>
		</span>
	</span>


        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/blog/posts/57649896.html#comments" class="article-comment-link">评论</a></span>
        
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <h2 id="系统环境"><a href="#系统环境" class="headerlink" title="系统环境"></a>系统环境</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># CentOS8 root用户</span></span><br><span class="line">uname -a</span><br><span class="line">Linux localhost.localdomain 4.18.0-80.el8.x86_64 <span class="comment">#1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux</span></span><br></pre></td></tr></table></figure>

<h2 id="安装依赖项"><a href="#安装依赖项" class="headerlink" title="安装依赖项"></a>安装依赖项</h2><h3 id="Git"><a href="#Git" class="headerlink" title="Git"></a>Git</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install git</span><br></pre></td></tr></table></figure>

<h3 id="Nginx"><a href="#Nginx" class="headerlink" title="Nginx"></a>Nginx</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装EPEL repo</span></span><br><span class="line">yum install epel-release</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更新repo，可不更新</span></span><br><span class="line">yum update</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装nginx</span></span><br><span class="line">yum install nginx</span><br></pre></td></tr></table></figure>

<h3 id="MySQL-Server"><a href="#MySQL-Server" class="headerlink" title="MySQL Server"></a>MySQL Server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 下载https://dev.mysql.com/downloads/repo/yum/</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 添加mysql repo到系统仓库列表，执行完之后在/etc/yum.repo.d/路径下生成mysql-community.repo和mysql-community-source.repo</span></span><br><span class="line">yum localinstall mysql80-community-release-el8-1.noarch.rpm</span><br><span class="line"></span><br><span class="line"><span class="comment"># CentOS8默认是开启了mysql模块，不取消的话无法通过上面的仓库配置去安装mysql</span></span><br><span class="line">yum module <span class="built_in">disable</span> mysql</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装mysql server，含依赖项mysql-community-client、mysql-community-common、mysql-community-libs</span></span><br><span class="line">yum install mysql-community-server</span><br></pre></td></tr></table></figure>
<h3 id="PHP"><a href="#PHP" class="headerlink" title="PHP"></a>PHP</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装yum-utils</span></span><br><span class="line">yum install yum-utils</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装EPEL repo，安装Nginx执行过</span></span><br><span class="line">yum install epel-release</span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载https://rpms.remirepo.net/enterprise/remi-release-8.rpm</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 添加repo，同理mysql</span></span><br><span class="line">yum install http://rpms.remirepo.net/enterprise/remi-release-8.rpm</span><br><span class="line"></span><br><span class="line"><span class="comment"># 获取php列表</span></span><br><span class="line">yum module list php</span><br><span class="line"></span><br><span class="line"><span class="comment"># 选择php7.4，也可以换成其他版本</span></span><br><span class="line">yum module <span class="built_in">enable</span> php:remi-7.4</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装php</span></span><br><span class="line">yum install php</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装必需的拓展</span></span><br><span class="line">yum install php-mbstring php-iconv php-curl php-mysqlnd</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装可选的拓展</span></span><br><span class="line">yum install php-gd php-apc php-xhprof</span><br></pre></td></tr></table></figure>

<h2 id="下载源码"><a href="#下载源码" class="headerlink" title="下载源码"></a>下载源码</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 本教程将代码放在了/var/www/phabricator目录下</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.com/phacility/libphutil.git</span><br><span class="line">git <span class="built_in">clone</span> https://github.com/phacility/arcanist.git</span><br><span class="line">git <span class="built_in">clone</span> https://github.com/phacility/phabricator.git</span><br></pre></td></tr></table></figure>

<h2 id="环境配置"><a href="#环境配置" class="headerlink" title="环境配置"></a>环境配置</h2><h3 id="配置Web服务器"><a href="#配置Web服务器" class="headerlink" title="配置Web服务器"></a>配置Web服务器</h3><p>本教程使用Nginx</p>
<h4 id="修改nginx-conf"><a href="#修改nginx-conf" class="headerlink" title="修改nginx.conf"></a>修改nginx.conf</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># nginx.conf 新增一个server</span></span><br><span class="line">server &#123;</span><br><span class="line">  listen      80; <span class="comment"># nginx默认有个server监听在80端口,需要把默认的注释掉或者换一个端口</span></span><br><span class="line">  server_name phabricator.gycherish.com;</span><br><span class="line">  root        /var/www/phabricator/phabricator/webroot; <span class="comment"># webroot是phabricator源码下的webroot</span></span><br><span class="line"></span><br><span class="line">  location / &#123;</span><br><span class="line">    index index.php;</span><br><span class="line">    rewrite ^/(.*)$ /index.php?__path__=/<span class="variable">$1</span> last;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  location /index.php &#123;</span><br><span class="line">    fastcgi_pass   localhost:9000;</span><br><span class="line">    fastcgi_index   index.php;</span><br><span class="line"></span><br><span class="line">    <span class="comment">#required if PHP was built with --enable-force-cgi-redirect</span></span><br><span class="line">    fastcgi_param  REDIRECT_STATUS    200;</span><br><span class="line"></span><br><span class="line">    <span class="comment">#variables to make the $_SERVER populate in PHP</span></span><br><span class="line">    fastcgi_param  SCRIPT_FILENAME    <span class="variable">$document_root</span><span class="variable">$fastcgi_script_name</span>;</span><br><span class="line">    fastcgi_param  QUERY_STRING       <span class="variable">$query_string</span>;</span><br><span class="line">    fastcgi_param  REQUEST_METHOD     <span class="variable">$request_method</span>;</span><br><span class="line">    fastcgi_param  CONTENT_TYPE       <span class="variable">$content_type</span>;</span><br><span class="line">    fastcgi_param  CONTENT_LENGTH     <span class="variable">$content_length</span>;</span><br><span class="line"></span><br><span class="line">    fastcgi_param  SCRIPT_NAME        <span class="variable">$fastcgi_script_name</span>;</span><br><span class="line"></span><br><span class="line">    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;</span><br><span class="line">    fastcgi_param  SERVER_SOFTWARE    nginx/<span class="variable">$nginx_version</span>;</span><br><span class="line"></span><br><span class="line">    fastcgi_param  REMOTE_ADDR        <span class="variable">$remote_addr</span>;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="运行nginx"><a href="#运行nginx" class="headerlink" title="运行nginx"></a>运行nginx</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">enable</span> nginx <span class="comment"># 开机启动</span></span><br><span class="line">systemctl start nginx <span class="comment"># 启动nginx</span></span><br></pre></td></tr></table></figure>

<h3 id="配置MySQL"><a href="#配置MySQL" class="headerlink" title="配置MySQL"></a>配置MySQL</h3><h4 id="运行mysqld"><a href="#运行mysqld" class="headerlink" title="运行mysqld"></a>运行mysqld</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">enable</span> mysqld  <span class="comment"># 开机启动</span></span><br><span class="line">systemctl start mysqld  <span class="comment"># 启动mysqld</span></span><br></pre></td></tr></table></figure>

<h4 id="查看临时密码"><a href="#查看临时密码" class="headerlink" title="查看临时密码"></a>查看临时密码</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># mysqld启动后会默认创建root'@'localhost账户</span></span><br><span class="line">grep <span class="string">'temporary password'</span> /var/<span class="built_in">log</span>/mysqld.log</span><br></pre></td></tr></table></figure>

<h4 id="使用临时密码登陆"><a href="#使用临时密码登陆" class="headerlink" title="使用临时密码登陆"></a>使用临时密码登陆</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 执行该命令后输入临时密码即可成功登陆</span></span><br><span class="line">mysql -uroot -p</span><br></pre></td></tr></table></figure>

<h4 id="修改密码"><a href="#修改密码" class="headerlink" title="修改密码"></a>修改密码</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 登陆成功后执行以下命令即可修改密码，由于mysql的密码合法性校验默认开启，</span></span><br><span class="line"><span class="comment"># 故需要给出符合条件的密码格式，尽量复杂点即可通过，注意后面的";"不能省略</span></span><br><span class="line">ALTER USER <span class="string">'root'</span>@<span class="string">'localhost'</span> IDENTIFIED BY <span class="string">'Gy123456!'</span>;</span><br></pre></td></tr></table></figure>

<h4 id="使phabricator能够连接上数据库"><a href="#使phabricator能够连接上数据库" class="headerlink" title="使phabricator能够连接上数据库"></a>使phabricator能够连接上数据库</h4><p>进入phabricator源码目录，执行一下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">./bin/config <span class="built_in">set</span> mysql.host localhost <span class="comment"># 127.0.0.1</span></span><br><span class="line">./bin/config <span class="built_in">set</span> mysql.user root</span><br><span class="line">./bin/config <span class="built_in">set</span> mysql.pass Gy123456!</span><br></pre></td></tr></table></figure>
<p>上述命令会修改phabricator的配置文件如下所示：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># conf/local/local.json</span></span><br><span class="line">&#123;</span><br><span class="line">	<span class="string">"mysql.pass"</span>: <span class="string">"Gy123456!"</span>,</span><br><span class="line">    <span class="string">"mysql.user"</span>: <span class="string">"root"</span>,</span><br><span class="line">    <span class="string">"mysql.host"</span>: <span class="string">"localhost"</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="生成phabricator相关数据库"><a href="#生成phabricator相关数据库" class="headerlink" title="生成phabricator相关数据库"></a>生成phabricator相关数据库</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./bin/storage upgrade <span class="comment"># 每次phabricator更新后都需要运行该命令</span></span><br></pre></td></tr></table></figure>

<h3 id="运行php-fpm"><a href="#运行php-fpm" class="headerlink" title="运行php-fpm"></a>运行php-fpm</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">enable</span> php-fpm  <span class="comment"># 开机启动</span></span><br><span class="line">systemctl start php-fpm  <span class="comment"># 启动php-fpm</span></span><br></pre></td></tr></table></figure>

<h3 id="关闭防火墙"><a href="#关闭防火墙" class="headerlink" title="关闭防火墙"></a>关闭防火墙</h3><p>因为防火墙的存在，外部主机无法直接与服务器建立连接，这里为了简单直接停止防火墙，更好的做法是配置防火墙的策略。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">disable</span> firewalld <span class="comment"># 禁止开机启动</span></span><br><span class="line">systemctl stop firewalld <span class="comment"># 停止防火墙</span></span><br></pre></td></tr></table></figure>

<h3 id="关闭selinux"><a href="#关闭selinux" class="headerlink" title="关闭selinux"></a>关闭selinux</h3><p>正常情况下在做完上述配置后就可以正常访问phabricator了，但是本人遇到了以下问题：<br><img src="/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/502-bad-gateway.png" alt=""></p>
<p>经过较长时间的排查发现是selinux搞的鬼，日志如下：<br><img src="/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/selinux.png" alt=""></p>
<p>为了简单，这里直接关闭selinux：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment"># 临时关闭</span></span><br><span class="line">setenforce 0</span><br><span class="line"></span><br><span class="line"><span class="comment"># 将配置文件/etc/selinux/config中SELINUX改为disable,重启后生效,永久关闭</span></span><br><span class="line">SELINUX=disabled</span><br></pre></td></tr></table></figure>
<h3 id="修改host文件"><a href="#修改host文件" class="headerlink" title="修改host文件"></a>修改host文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># C:\Windows\System32\drivers\etc\hosts 新增映射</span></span><br><span class="line">192.168.86.128 phabricator.gycherish.com</span><br></pre></td></tr></table></figure>

<h3 id="访问phabricator"><a href="#访问phabricator" class="headerlink" title="访问phabricator"></a>访问phabricator</h3><p>直接在浏览器中输入phabricator.gycherish.com即可完成访问：<br><img src="/blog/images/Git/%E5%9F%BA%E4%BA%8EPhabricator%E7%9A%84Git%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BA/register.png" alt=""></p>
<p>至此phabricator服务器搭建初步完成，后续可以进行相关配置来使用以及完善phabricator功能使其能够完成正常git的开发需求。</p>
<h2 id="相关链接"><a href="#相关链接" class="headerlink" title="相关链接"></a>相关链接</h2><ul>
<li><a href="https://github.com/phacility/phabricator" target="_blank" rel="noopener">Phabricator项目地址</a></li>
<li><a href="https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/" target="_blank" rel="noopener">Nginx安装</a></li>
<li><a href="https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html" target="_blank" rel="noopener">MySQL安装</a></li>
<li><a href="https://linuxize.com/post/how-to-install-php-on-centos-8/" target="_blank" rel="noopener">PHP安装</a></li>
</ul>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://gycherish.gitee.io/blog/posts/57649896.html" title="基于Phabricator的Git服务器搭建" target="_blank" rel="external">https://gycherish.gitee.io/blog/posts/57649896.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用 <a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN协议</a> 许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/gycherish" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="/blog/images/head.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/gycherish" target="_blank"><span class="text-dark">惘客</span><small class="ml-1x">Linux C++ Server Developer</small></a></h3>
        <div>宁静致远，淡泊明志！</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/blog/posts/2a40ac23.html" title="Docker安装"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    <li class="next">
      <a href="/blog/posts/be05c311.html" title="TMUX使用教程"><span>下一篇&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
  </ul>
  
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-fancy btn-donate pop-onhover bg-gradient-warning" data-toggle="modal" data-target="#donateModal"><span>赏</span></button>
  <!-- <div class="wave-icon wave-icon-danger btn-donate" data-toggle="modal" data-target="#donateModal">
    <div class="wave-circle"><span class="icon"><i class="icon icon-bill"></i></span></div>
  </div> -->
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  
<!-- Modal -->
<div class="modal modal-center modal-small modal-xs-full fade" id="donateModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content donate">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="modal-body">
        <div class="donate-box">
          <div class="donate-head">
            <p>感谢您的支持，我会继续努力的!</p>
          </div>
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade active in" id="alipay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/alipay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开支付宝扫一扫，即可进行扫码打赏哦</p>
            </div>
            <div role="tabpanel" class="tab-pane fade" id="wechatpay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/wechatpay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开微信扫一扫，即可进行扫码打赏哦</p>
            </div>
          </div>
          <div class="donate-footer">
            <ul class="nav nav-tabs nav-justified" role="tablist">
              <li role="presentation" class="active">
                <a href="#alipay" id="alipay-tab" role="tab" data-toggle="tab" aria-controls="alipay" aria-expanded="true"><i class="icon icon-alipay"></i> 支付宝</a>
              </li>
              <li role="presentation" class="">
                <a href="#wechatpay" role="tab" id="wechatpay-tab" data-toggle="tab" aria-controls="wechatpay" aria-expanded="false"><i class="icon icon-wepay"></i> 微信支付</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>



</main>

  <footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2024 惘客
        
        <!-- <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div> -->
        <div class="police">
            <img src="/blog/images/beian.png" style="float:left;" /><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=41152702000156" target="_blank">豫公网安备41152702000156号</a>
        </div>
        <div class="beianinfo">
            <a href="https://beian.miit.gov.cn/" target="_blank">豫ICP备2021012829号</a>
        </div>
    </div>
</footer>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>

<script src="/blog/js/plugin.min.js"></script>


<script src="/blog/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/blog/',
        CONTENT_URL: '/blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/blog/js/insight.js"></script>






   
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





   







<!-- 添加回到顶部按钮 -->
<div id="go-top"></div>
<style type="text/css">
#go-top {
 width:40px;height:40px;
 background-color:#8cc2ff;
 position:relative;
 border-radius:20px;
 position:fixed;right:10px;bottom:60px;
 cursor:pointer;display:none;
}
#go-top:after {
 content:" ";
 position:absolute;left:14px;top:14px;
 border-top:2px solid #fff;border-right:2px solid #fff;
 width:12px;height:12px;
 transform:rotate(-45deg);
}
#go-top:hover {
 background-color:#8A2BE2;
}
</style>
<script>
$(function () {
  var top=$("#go-top");
  $(window).scroll(function () {
    ($(window).scrollTop() > 300) ? top.show(300) : top.hide(200);
    $("#go-top").click(function () {
      $('body,html').animate({scrollTop:0});
      return false();
    })
  });
});
</script>
</body>
</html>